package constants

import (
	"jvm/instructions/base"
	"jvm/rtda"
)

type BIPUSH struct {
	val int8
}

func (b *BIPUSH) FetchOperands(reader *base.BytecodeReader) {
	b.val = reader.ReadInt8()
}

func (b *BIPUSH) Execute(jFrame *rtda.JFrame) {
	i := int32(b.val)
	jFrame.OperandStack().PushInt(i)
}

type SIPUSH struct {
	val int16
}

func (b *SIPUSH) FetchOperands(reader *base.BytecodeReader) {
	b.val = reader.ReadInt16()
}

func (b *SIPUSH) Execute(jFrame *rtda.JFrame) {
	i := int32(b.val)
	jFrame.OperandStack().PushInt(i)
}
